class MyObject(object):
    def __init__(self):
        self.public_field = 5
        self.__private_filed = 10
    
    def get_private_field(self):
        return self.__private_filed
    @classmethod
    def get_private_filed2(cls, instance):
        return instance.__private_filed

foo = MyObject()
assert foo.public_field == 5
assert foo.get_private_field() == 10

bar = MyObject()
assert MyObject().get_private_filed2(bar) == 10

class MyParentObject(object):
    def __init__(self):
        self.__private_field = 70
    
class MyChildObject(MyParentObject):
    def get_private_filed(self):
        return self.__private_field  # ERROR:'MyChildObject' object has no attribute '_MyChildObject__privarte_field'

baz = MyChildObject()
# baz.get_private_filed()
# assert baz._MyParentObject__private_field == 70
assert baz._MyParentObject__private_field == 70
print(baz.__dict__)

##****************************************

# add MyBaseClass
class MyBaseClass(object):
    def __init__(self, value):
        self.__value = value

class MyClass(MyBaseClass):
    
    def get_value(self):
        return str(self.__value)

class MySubClass(MyClass):
    def get_value(self):
        return int(self._MyClass__value) # 'MySubClass' object has no attribute '_MyClass__value'

foo = MySubClass(5)
assert foo.get_value() == 5


# define more protect attribute